package model

import (
	"context"
	"service/ctrl"
	"service/model/mod"

	gpb "gitee.com/cloudapex/protos/hr_cache/pb"

	"google.golang.org/grpc"
)

var UserCacheServer userCacheServer

func init() {
	ctrl.GCon.RegistClienter(mod.GCONN_HR_CACHE, func(c *grpc.ClientConn) { UserCacheServer.cli = gpb.NewUserLoginCacheServerClient(c) })
}

type userCacheServer struct {
	cli gpb.UserLoginCacheServerClient
}

func (this *userCacheServer) UserNameList(ctx context.Context, in *gpb.UserLoginReqIdsReq) (*gpb.UserLoginListRes, error) {
	return this.cli.GetLoginNameList(ctx, in)
}
func (this *userCacheServer) AddLoginCacheInfo(ctx context.Context, in *gpb.LoginCacheReq) (*gpb.LoginCacheRes, error) {
	return this.cli.AddLoginCacheInfo(ctx, in)
}
func (this *userCacheServer) EditLoginCacheInfo(ctx context.Context, in *gpb.LoginCacheReq) (*gpb.LoginCacheRes, error) {
	return this.cli.EditLoginCacheInfo(ctx, in)
}

func (this *userCacheServer) GetAllLoginCache(ctx context.Context, in *gpb.LoginCacheReq) (*gpb.UserLoginRes, error) {
	return this.cli.GetAllLoginCache(ctx, in)
}

// 说明：根据员工workId切片  返回对应的员工信息 LoginNameInfo
// 参数：1.CId     公司ID
// 2.[]WorkId     员工WorkId切片
func (this *userCacheServer) GetLoginsByWorkId(ctx context.Context, in *gpb.WorkIds) (*gpb.UserLoginListRes, error) {
	return this.cli.GetLoginsByWorkId(ctx, in)
}
